﻿using System;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;

namespace SPConnections.SandboxingDemo.WebParts.DemoPart
{
    [ToolboxItem(false)]
    public partial class DemoPart : System.Web.UI.WebControls.WebParts.WebPart
    {
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            base.AddAttributesToRender(writer);
            writer.AddAttribute("data-constructor", "DemoWebPart");
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            InitializeControl();
        }

        protected override void RenderChildren(HtmlTextWriter writer)
        {
            writer.RenderBeginTag(HtmlTextWriterTag.P);
            writer.WriteEncodedText("This is a demo web part");
            writer.RenderEndTag();
        }
    }
}
